<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>information</title>
</head>

<body id="all">
    <p>姓名：<input type="text"></p>
    <p>年龄：<input type="text"></p>
    <p>电话：<input type="text"></p>
    <p>住址：<input type="text"></p>
    <button>确定</button>
    <script>
        var All = document.getElementById("all")
        var V = 0;
        for (var i = 0; i < All.childNodes.length; i++) {
            if (All.childNodes[i].nodeType) {
                V++;
            }

        }
        console.log("body的子元素的节点一共有" + V + "个");
        for (var j = 0; j < All.childNodes.length; j++) {
            console.log("第" + j + "个节点名称是：" + All.childNodes[j].nodeName);
        }
        All.innerText;
    </script>
</body>

</html>